<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 17728
  Date: 2020/10/12
  Time: 14:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <%@ include file="/pages/common/head.jsp" %>
    <script type="text/javascript" src="static/js/wangEditor.js"></script>
    <script type="text/javascript">


        $(function () {
            const E = window.wangEditor
            const editor = new E('#div1')
            // 或者 const editor = new E( document.getElementById('div1') )
            editor.create()
            $("#judge").click(function () {
                $("#input1").val(editor.txt.text());
            })
        })

        function fun() {
            $.ajax({
                url: "http://localhost:8080/Work_war_exploded/TeacherServlet",
                data: {action: "queryTeacher1"},
                type: "GET",
                success: function (data) {
                    var jsonObj = JSON.parse(data);
                    var str = "";
                    $.each(jsonObj, function (index, teachers) {
                        str = $("<option />");
                        str.html(teachers.name);
                        str.val(teachers.id);
                        $("#t_id").append(str);
                    })

                },
                dataType: "text"
            });
        }

    </script>
    <style type="text/css">
        html, body {
            margin: 0;
            padding: 0;
            background-color: honeydew;
        }

        .navbar {
            margin: 0 auto;
            width: 100%;
        }

        .header {
            background-image: linear-gradient(to right, #100736, #602D4F);
            width: 100%;
            height: 150px;
            color: #FFFFFF;
            font-size: 50px;
            position: relative;
            top: 0.625rem;

        }

        .hleft {
            float: left;
        }

        .hright {
            float: right;
        }

        .part2 {
            width: 100%;
            height: 550px;
            /* border: 1px solid red; */
            position: relative;
            top: 20px;

        }

        .left2 {
            position: relative;
            left: 10px;
            width: 58%;
            height: 550px;
            /* border: 1px solid red; */
            float: left;
            position: relative;
            background-color: white;


        }

        .b {
            height: 512px;
        }

        .right2 {
            position: relative;
            right: 10px;
            width: 40%;
            height: 550px;
            /* border: 1px solid red; */
            float: right;
            background-color: #8F613A;
        }

        .ye {
            text-align: center;
        }

        #liuyan {
            width: 97.4%;
            height: 530px;
            background-color: #F5E3B2;
            position: relative;
            top: -10px;
            left: 10px;
        }

        .liuyan {
            position: relative;
            left: 20px;
        }

        .tea1 {
            width: 200px;
        }

        .tijaio {
            position: relative;
            left: 170px;
        }

        table {
            background-color: white;
        }

        #bottom {
            width: 100%;
            height: 180px;
            position: relative;
            top: 100px;
            background-color: #2A2730;
            color: #FFFFFF;
        }

        #bottom p {
            text-align: center;
        }

        #div1 {
            width: 700px;
            background-color: white;
        }
    </style>
</head>
<body onload="fun()">
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">&nbsp;&nbsp;&nbsp;作业棒&nbsp;&nbsp;&nbsp;</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li class="active"><a href="NoticeServlet?action=page&pageNo=1">学生界面<span
                        class="sr-only">(current)</span></a></li>
                <li><a href="HwServlet?action=queryHwStu">下载作业</a></li>
                <li><a href="HwServlet?action=queryHw">提交作业</a></li>
                <li><a href="StudentServlet?action=query">个人信息</a></li>
                <li><a href="pages/student/student_change.jsp">修改密码</a></li>

            </ul>

            <ul class="nav navbar-nav navbar-right">
                <li><a href="UserServlet?action=logout">&nbsp;&nbsp;&nbsp;退出&nbsp;&nbsp;&nbsp;</a></li>


            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
<div class="header">
    <div class="hleft">
        <c:choose>
            <c:when test="${sessionScope.teacher != null && sessionScope.student == null}"><!-- 如果 -->
            </c:when>
            <c:otherwise> <!-- 否则 -->
                <c:choose>
                    <c:when test="${sessionScope.student == null}"><!-- 如果 -->
                        完善个人信息，否则无法进行操作！
                    </c:when>
                    <c:otherwise>你好，${sessionScope.student.sname}</c:otherwise>
                </c:choose>
            </c:otherwise>
        </c:choose>
    </div>
    <br>
    <div class="hright">
        <div id="datetime">
            <script>
                setInterval("document.getElementById('datetime').innerHTML=new Date().toLocaleString();", 1000);
            </script>
        </div>
    </div>
</div>

<div class="part2">
    <div class="left2">
        <div class="b">
            <table class="table table-hover">
                <thead align="center">
                <tr>
                    <td colspan="5"><h3>公告板</h3></td>
                </tr>
                <tr>
                    <td>标题</td>
                    <td>操作</td>
                </tr>
                </thead>
                <tbody id="tbody" align="center">
                <c:forEach items="${ requestScope.page.items }" var="item">
                    <tr align=\"center\">
                        <td colspan=\"4\">${ item.title }</td>
                        <td><a href='pages/board/board_look.jsp'>查看</a>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
                <%--      <tr align="center">--%>

                <%--        <td colspan="4">标题</td>--%>
                <%--        <td>查看</td>--%>
                <%--      </tr>--%>
                <%--      <tr align="center">--%>
                <%--        <td colspan="4" id="title1"></td>--%>
                <%--        <td>查看</td>--%>
                <%--      </tr>--%>


            </table>

        </div>
        <div class="ye">
            <%@include file="/tool/page_nav.jsp" %>
        </div>
    </div>
    <div class="right2">
        <div id="liuyan">

            <div align="center"><h2>留言板</h2></div>
            <br/>
            <div class="liuyan">
                <form class="form-horizontal" action="MessageServlet" method="get">
                    <input type="hidden" name="action" value="saveMessage">
                    <input type="hidden" name="content" id="input1"/>
                    <div class="tea1">
                        <select class="form-control" id="t_id" name="t_id">
                            <option>请选择老师</option>

                        </select>
                    </div>
                    <div>
                        <input type="text" name="title" style="font-size: 16px">(标题)
                    </div>

                    <div id="div1">

                    </div>
                    <div class="tijaio">
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <button type="submit" class="btn btn-default" value="   添加   " id="judge">&nbsp;&nbsp;&nbsp;提交&nbsp;&nbsp;&nbsp;</button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<%@include file="/pages/common/footer.jsp" %>
</body>
</html>
